package com.jzt.ic.service;

import com.jzt.service.ServiceA;
import com.jzt.service.ServiceB;
import com.jzt.service.ServiceC;
import com.yvan.dsf.anno.DsfConsumer;
import com.yvan.dsf.anno.DsfService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.atomic.AtomicLong;

/**
 * Created by luoyifan on 2017/11/24.
 */
@DsfService
public class ServiceAImp implements ServiceA {

    private static final Logger LOGGER = LoggerFactory.getLogger(ServiceAImp.class);
    private static final AtomicLong A_COUNTS = new AtomicLong(0);

    @DsfConsumer
    private ServiceB serviceB;
    @DsfConsumer
    private ServiceC serviceC;

    @Override
    public String linkABC() {
        return "A" + serviceB.linkABC();
    }

    @Override
    public String aFinish(String v) {
        LOGGER.info("a finish:" + A_COUNTS.incrementAndGet());
        return v + "a";
    }

    @Override
    public String invokeB(String v) {
        return serviceB.bFinish(v + "a");
    }

    @Override
    public String invokeC(String v) {
        return serviceC.cFinish(v + "a");
    }
}
